package db_yxres

import (
	"database/sql"
	"fmt"
	// 引入优炫 数据库驱动
	// TODO 测试临时屏蔽
	_ "gitee.com/zhendliu/sorm/driver/driver/yxres/uxgo"
)

func GetDriverName() string {
	return "UXres"
}

func GetDSN(user string, password string, host string, port int, database string) string {
	//"host=192.168.0.110 port=5432 user=uxdb password=12345678ab dbname=uxdb sslmode=disable"
	dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, database)
	return dsn
}

func Open(dsn string) (db *sql.DB, err error) {
	db, err = sql.Open(GetDriverName(), dsn)
	if err != nil {
		return
	}
	return
}
